<div class="view ui-corner-all">
	<div class="row">
	<?php $this->widget('zii.widgets.grid.CGridView', array(
		'id'=>'cargo-grid',
		'dataProvider'=>$grid->packing_grid($model->package->packing_list),
		'columns'=>array(
			array('class'=>'CCheckBoxColumn'),
			'in_date:date:Date',
			'do_ref.ref_no:text:Ref',
			'shipper.cname:text:Shipper',
			'consignee.cname:text:Consignee',
		),
	)); ?>
	</div>
</div>
<?php $this->endWidget(); ?>
<?php 
$cs = Yii::app()->getClientScript();
$script =<<<EOD
	$('#packing-list-packages-cargo-form [type=submit]').click(function(){
	var params = [];
	var cargo_id = $('[name^=cargo-grid_c0]:checkbox:checked:last');
	var name = "packing_list_packages_cargo[cargo_id]";
	if(cargo_id == undefined)
		params[name] = '';
	else
		params[name] = cargo_id;
	var form = $.extend($.simplelogform,{afterSubmit:function(data){window.location = "$ViewURL?id="+data.id;}});
	form.Submit($('#packing-list-details-form'),params);
	return false;
});
EOD;
?>